<template>
  <div class="wel">
    <First></First>
    <Third :customer="customer"></Third>
    <Second :customer="customer"></Second>
    <Fourth></Fourth>
  </div>
</template>
<script>
    import {mapState, mapGetters} from "vuex";
    import First from "@/components/home/First";
    import Second from "@/components/home/Second";
    import Third from "@/components/home/Third";
    import Fourth from "@/components/home/Fourth";
    import {getNextCustomer} from '@/api/home'

    export default {
        name: "wel",
        components: {First, Second, Third, Fourth},
        data() {
            return {
                customer: []
            }
        },
        computed: {
            ...mapState(['common']),
            ...mapGetters(["userInfo"])
        },
        created() {
            // if (!this.userInfo.account) return;
            //邮箱列表
            if (this.common.emailList.length == 0) {
                this.$store.dispatch('update_emailList')
            }
            //获取下属客户
            this.getNextCustomer();
            //获取标签
            if (this.common.labelList.length == 0) {
                this.$store.dispatch('update_labelList')
            }
            //获取全部字典
            if (this.common.commonUnits.length == 0) {
                this.$store.dispatch('get_common_units')
            }
        },
        methods: {
            getNextCustomer() {
                getNextCustomer().then(res => {
                    if (res.data.success) {
                        this.customer = res.data.data;
                    }
                })
            }
        }
    };
</script>

<style scoped="scoped" lang="scss">
  .wel {
    width: 1280px;
    margin: 30px auto;
  }
</style>
